package me.zk.practice1.s;

/**
 * @author zhangkai
 * @date 2023/7/15 13:36
 */
public class LS_Offer_28 {
    public boolean isSymmetric(TreeNode root) {
        if (root == null) {
            return false;
        }
        return helper(root.left,root.right);
    }

    public boolean helper(TreeNode l,TreeNode r) {

        if (l == null && r== null) {
            return true;
        }
        if (l==null || r==null) {
            return false;
        }

        return l.val == r.val && helper(l.left,r.right) && helper(l.right,r.left);

    }
}
